<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改生产实习信息')"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-edit" th:object="${production}">
        <input id="productionId" name="productionId" th:field="*{productionId}" type="hidden"/>
        <div class="form-group">
            <label class="col-sm-3 control-label ">名称：</label>
            <div class="col-sm-8">
                <textarea class="form-control" id="productionName" name="productionName" required
                          th:field="*{productionName}" type="text"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">申请要求：</label>
            <div class="col-sm-8">
                <input class="form-control" id="productionRequire" name="productionRequire" required
                       th:field="*{productionRequire}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">开始时间：</label>
            <div class="col-sm-8">
                <input class="form-control" id="productionBegin" name="productionBegin" placeholder="年-月-日"
                       required th:field="*{productionBegin}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">结束时间：</label>
            <div class="col-sm-8">
                <input class="form-control" id="productionEnd" name="productionEnd" placeholder="年-月-日"
                       required th:field="*{productionEnd}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">申请截至时间：</label>
            <div class="col-sm-8">
                <input class="form-control" id="productionOver" name="productionOver" placeholder="年-月-日"
                       required th:field="*{productionOver}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">实习单位名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="productionCompany" name="productionCompany" required
                       th:field="*{productionCompany}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">实习单位简介：</label>
            <div class="col-sm-8">
                <textarea class="form-control" id="productionIntro" name="productionIntro" required
                          th:field="*{productionIntro}" type="text"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业数量：</label>
            <div class="col-sm-8">
                <input class="form-control" id="productionWeeks" name="productionWeeks" required
                       th:field="*{productionWeeks}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业要求：</label>
            <div class="col-sm-8">
                <textarea class="form-control" id="productionWeekly" name="productionWeekly" required
                          th:field="*{productionWeekly}" type="text"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">作业成绩占比(%)：</label>
            <div class="col-sm-8">
                <input class="form-control" id="pacific" name="pacific" required th:field="*{pacific}" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">总结成绩占比(%)：</label>
            <div class="col-sm-8">
                <input class="form-control" id="exam" name="exam" required th:field="*{exam}" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<script type="text/javascript">
    $(function () {
        $("#productionBegin").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("#productionEnd").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("#productionOver").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    });

    function edit() {
        var productionId = $("input[name='productionId']").val();
        var productionName = $("input[name='productionName']").val();
        var productionRequire = $("textarea[name='productionRequire']").val();
        var productionBegin = $("input[name='productionBegin']").val();
        var productionEnd = $("input[name='productionEnd']").val();
        var productionOver = $("input[name='productionOver']").val();
        var productionCompany = $("input[name='productionCompany']").val();
        var productionIntro = $("textarea[name='productionIntro']").val();
        var productionWeeks = $("input[name='productionWeeks']").val();
        var productionWeekly = $("textarea[name='productionWeekly']").val();
        var pacific = $("input[name='pacific']").val();
        var exam = $("input[name='exam']").val();
        $.ajax({
            cache: true,
            type: "POST",
            url: ctx + "sau/production/updateProduction",
            data: {
                "productionId": productionId,
                "productionName": productionName,
                "productionRequire": productionRequire,
                "productionBegin": productionBegin,
                "productionEnd": productionEnd,
                "productionOver": productionOver,
                "productionCompany": productionCompany,
                "productionIntro": productionIntro,
                "productionWeeks": productionWeeks,
                "productionWeekly": productionWeekly,
                "pacific": pacific,
                "exam": exam
            },
            async: false,
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.operate.successCallback(data);
            }
        });
    }

    function submitHandler() {
        if ($.validate.form()) {
            edit();
        }
    }
</script>
</body>
</html>
